﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GameServer.Networking.Packets
{
    class SP_ROOM_INFO : Packet
    {
        public SP_ROOM_INFO(int tType, params object[] Params)
        {
            newPacket(30000);
            addBlock(1);
            for (int i = 0; i < Params.Length; i++)
            {
                addBlock(Params[i]);
                if (tType != 111111)
                {
                    if (i == 2)
                    {
                        addBlock(tType);
                    }
                }
            }
        }
    }
    
    class RoomDataNewRound : Packet
    {
        public RoomDataNewRound(Virtual_Objects.User.virtualUser Client, Virtual_Objects.Room.virtualRoom Room, int WinningTeam, bool Prepare)
        {
            int Code = (Prepare == true ? 6 : 5);
            Random newRandom = new Random();
            newPacket(30000);
            addBlock(1);
            addBlock(-1);
            addBlock(Room.ID);
            addBlock(1);
            addBlock(Code);
            addBlock(0);
            addBlock(1);
            addBlock(WinningTeam);
            addBlock(Room.cDerbRounds);
            addBlock(Room.cNiuRounds);
            addBlock(Code);
            addBlock(0);
            addBlock(1);
            addBlock(0);
            addBlock(0);
            addBlock(0);
            addBlock(0);
            addBlock(0);
            addBlock(0);
            addBlock("0.0000");
            addBlock("0.0000");
            addBlock("0.0000");
            addBlock("0.0000");
            addBlock("0.0000");
            addBlock("0.0000");
            addBlock(0);
            addBlock(0);
            addBlock("DU01");
        }
    }

    class PACKET_SPAWN : Packet
    {
        public PACKET_SPAWN(Virtual_Objects.User.virtualUser User)
        {
            if (User != null && User.Room != null)
            {
                newPacket(30000); // Room Packet
                addBlock(1); // Success
                addBlock(-1);
                addBlock(3);
                addBlock(1);
                addBlock(5);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
            }
        }
    }
    class PACKET_REQUEST : Packet
    {
        public PACKET_REQUEST(Virtual_Objects.User.virtualUser User)
        {
            if (User != null && User.Room != null)
            {
                newPacket(30000); // Room Packet
                addBlock(1); // Success
                addBlock(-1);
                addBlock(3);
                addBlock(1);
                addBlock(7);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
                addBlock(0);
            }
        }
    }

    class PACKET_ROOM_DATA : Packet
    {
        public PACKET_ROOM_DATA(Virtual_Objects.User.virtualUser User, params object[] Params)
        {
            newPacket(30000);
            addBlock(1);
            for (int i = 0; i < Params.Length; i++)
            {
                addBlock(Params[i]);

            }
        }

        public PACKET_ROOM_DATA(string tick, int tType, params object[] Params)
        {
            newPacket(30000);
            addBlock(0);
            for (int i = 0; i < Params.Length; i++)
            {
                addBlock(Params[i]);
            }
        }
    }
}